﻿using Clancy.Common;
using Clancy.Interfaces;
using System;
using System.Windows.Media;

namespace Clancy.Ui.ViewModels
{
    public class RecordingThumbnailViewModel
    {
        private readonly IRecording m_Recording;

        public RecordingThumbnailViewModel(IRecording recording)
        {
            m_Recording = recording;

            Duration = m_Recording.Duration;
            Timestamp = m_Recording.Timestamp;
            SurveilanceName = m_Recording.SurveilanceName;

            if (m_Recording == null)
                return;
            Thumbnail = m_Recording.PreviewThumnbailAsJepg.ToBitmapSource();
        }

        public virtual TimeSpan Duration { get; private set; }

        public IRecording Recording
        {
            get { return m_Recording; }
        }

        public virtual string SurveilanceName { get; private set; }

        public virtual ImageSource Thumbnail { get; private set; }

        public virtual DateTime Timestamp { get; private set; }
    }
}